Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compiler-v2] Add loop labels to the language #14868

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

wrwg
Copy link
Contributor

@wrwg wrwg commented Oct 4, 2024

Description

Besides the user being able to describe complex algorithms more efficiently, loop labels are required to express aribtrary reducible control flow graphs in the AST language, and create parity of the AST with the bytecode level for this kind of code (which is also what can be generated from Move).

How Has This Been Tested?

New baseline tests in checking, v1-checking, bytecode generation, and a transactional test.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Copy link

trunk-io bot commented Oct 4, 2024

⏱️ 2h 50m total CI duration on this PR
Slowest 15 Jobs Cumulative Duration Recent Runs
rust-move-unit-coverage 16m 🟩
dispatch_event 16m 🟩
rust-move-unit-coverage 16m 🟩
rust-move-unit-coverage 16m 🟩
rust-move-unit-coverage 15m 🟩
dispatch_event 14m 🟩
rust-move-unit-coverage 11m 🟩
rust-move-tests 10m 🟩
rust-move-tests 10m 🟩
rust-move-tests 9m 🟩
rust-move-tests 9m 🟩
rust-move-tests 9m 🟩
rust-cargo-deny 9m 🟩🟩🟩🟩🟩
check-dynamic-deps 6m 🟩🟩🟩🟩🟩
general-lints 2m 🟩🟩🟩🟩🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

wrwg commented Oct 4, 2024

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 71.52318% with 43 lines in your changes missing coverage. Please review.

Project coverage is 60.0%. Comparing base (cbb4431) to head (d134193).

Files with missing lines Patch % Lines
...hird_party/move/move-compiler/src/expansion/ast.rs 0.0% 18 Missing ⚠️
third_party/move/move-compiler/src/parser/ast.rs 0.0% 18 Missing ⚠️
third_party/move/move-model/src/lib.rs 0.0% 4 Missing ⚠️
...arty/move/move-compiler/src/expansion/translate.rs 66.6% 2 Missing ⚠️
third_party/move/move-compiler/src/parser/lexer.rs 66.6% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #14868    +/-   ##
========================================
  Coverage    60.0%    60.0%            
========================================
  Files         856      856            
  Lines      210624   210737   +113     
========================================
+ Hits       126573   126644    +71     
- Misses      84051    84093    +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@vineethk vineethk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty good! I have a few comments, but should be ready to go once they are addressed.

third_party/move/move-compiler/src/parser/syntax.rs Outdated Show resolved Hide resolved
@@ -505,6 +507,10 @@ fn find_token(
(get_name_token(&text[..len]), len)
}
},
'\'' => {
let len = get_name_len(&text[1..]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need some checks on the name, because the following code is currently allowed:

        ': loop {
            break ';
        };
        '1: loop {
            break '1;
        };
        '00x: loop {
            break '00x;
        };

We should ideally limit it to whatever our identifier rules are, which I think is what Rust does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wrwg Just checking if this comment was missed.

Copy link
Contributor Author

@wrwg wrwg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

@wrwg wrwg requested a review from vineethk October 9, 2024 02:51
Base automatically changed from wrwg/astifier to main October 9, 2024 04:27
Besides the user being able to describe more complex algorithms more efficiently, loop labels are required to express any reducible control flow in the AST language, and create parity of the AST with the bytecode level for this kind of code (which is also what can be generated from Move).
Copy link
Contributor

@vineethk vineethk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, have one comment to be addressed.

@@ -505,6 +507,10 @@ fn find_token(
(get_name_token(&text[..len]), len)
}
},
'\'' => {
let len = get_name_len(&text[1..]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wrwg Just checking if this comment was missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants